﻿using System.Data.SqlClient;

namespace QWManage.DAL
{
    public class UpdateLogsDAL : SqlDAL
    {
        public UpdateLogsDAL()
        {
            TableName = "WEB_UpdateLogs";
        }

        public void Log(string name, string remarks)
        {
            string sql = $"insert into {TableName} " +
                     $"(Name,remarks) values " +
                     $"(@Name,@remarks) ";

            //using (SqlConnection conn = new SqlConnection(SQLCON))
            //{
            //    conn.Open();
            //}

                SqlConnection conn = new SqlConnection(SQLCON);
            try
            {
                SqlCommand cmd = new SqlCommand(sql, conn);
                cmd.Parameters.Add(new SqlParameter("@Name", name));
                cmd.Parameters.Add(GetStringSqlParameter("@remarks", remarks));
                conn.Open();
                cmd.ExecuteNonQuery();
            }
            finally
            {
                conn.Close();
            }
        }
    }
}
